import * as actionType from "./actionType"
import axios from "axios";
import {fromJS} from "immutable"
export const getFocuseAction = () => ({
    type: actionType.SEARCH_FOCUSE
})
export const getBlurAction = () => ({
    type: actionType.SEARCH_BLUR
})
export const getMouseEnter = () => ({
    type: actionType.MOUSE_ENTER
})
export const getMouseLeave = () => ({
    type: actionType.MOUSE_LEAVE
})
export const changeList = (data) => ({
    type: actionType.CHANGE_LIST,
    data:fromJS(data),
    totalPage:Math.ceil(data.length / 10)
})
export const getList = () => {
    return (dispatch) => {
        axios.get("/api/headerList.json").then(res => {
            dispatch(changeList(res.data.data))
        }).catch(err => {
            console.log(err);
        })
    }
}
export const changePage=(page) =>({
    type:actionType.CHANGE_PAGE,
    page
})